package com.beantest;

import com.beantest.service.EventPublisherService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class BeanTestApplication {

    public static void main(String[] args) {
        SpringApplication.run(BeanTestApplication.class, args);
    }

    @Bean
    public CommandLineRunner demo(EventPublisherService eventPublisherService) {
        return args -> {
            eventPublisherService.publishCustomEvent("Hello, Spring Event!");
        };
    }
}
